// In App.js in a new project

import * as React from 'react';
import {View, Text, Button} from 'react-native';
import {
  NavigationContainer,
  ParamListBase,
  type NavigationProp,
} from '@react-navigation/native';
import {
  NativeStackScreenProps,
  createNativeStackNavigator,
} from '@react-navigation/native-stack';
import Login from '../views/Login';
import BottomTabs from '../components/BottomTabs/BottomTabs';
import SearchPage from '../views/Search';
import PlayVideo from '../views/play';

interface Props {
  route: any;
  navigation: NavigationProp<ParamListBase>;
}
function Details({route, navigation}: Props) {
  return (
    <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
      <Text>Details Screen</Text>
      <Text>传递的值 {route.params.id}</Text>
      <Button
        title="Update the title"
        onPress={() => navigation.setOptions({title: 'Updated!'})}
      />
      <Button
        title="Done"
        onPress={() => {
          // Pass and merge params back to home screen
          navigation.navigate({
            name: 'Home',
            params: {post: '传回的值 李四'},
            merge: true,
          });
        }}
      />
    </View>
  );
}
const Stack = createNativeStackNavigator();
function AppNavigator() {
  return (
    <NavigationContainer>
      <Stack.Navigator screenOptions={{headerShown: false}}>
        <Stack.Screen name="BottomTabs" component={BottomTabs} />
        <Stack.Screen name="Login" component={Login} />
        <Stack.Screen name="SearchPage" component={SearchPage} />
        <Stack.Screen name="Details" component={Details} />
        <Stack.Screen name="PlayVideo" component={PlayVideo} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export default AppNavigator;
